<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>删除的角色列表</title>
</head>
<link type="text/css" rel="stylesheet" th:href="@{~/bootstrap-3.3.7/css/bootstrap.css}"/>
<script type="text/javascript" th:src="@{~/bootstrap-3.3.7/js/jquery.js}"></script>
<script type="text/javascript" th:src="@{~/bootstrap-3.3.7/js/bootstrap.js}"></script>

<body>

<script>

</script>

<div class="container">
    <a href="javascript:void(0)" class="btn btn-success btn-primary btn-xs" th:onclick="'javascript:fanhui();'">返回角色列表</a>
    <script>
        function fanhui(){
            location.href="/role/listRole";
        }

        function huifu(id) {

            $.post(
                "/role/deleteRole",
                {
                    ids: id,
                    status: 0
                },
                function (data) {
                    if (data == 1) {
                        alert("恢复成功");
                        location.reload();
                    }
                    else {
                        alert("恢复失败")
                    }
                },
                "json"
            );

        }
    </script>
    <table class="table table-bordered table-hover">
        <tr>
            <td>编号</td>
            <td>角色名称</td>
            <td>介绍</td>
            <td>状态</td>
            <td>操作</td>
        </tr>

        <!-- 该出不允许 出现空格  在role 后面逗号后面跟的状态变量-->
        <tr th:each="role,roleStat : ${lists}">
            <td th:text="${roleStat.count}"></td>
            <td th:text="${role.name}">xx</td>
            <td th:text="${role.description}">xx</td>
            <td th:text="${role.status == 1}? '禁用' : '启用'">xx</td>
            <td>
                <a href="javascript:void(0)" class="btn btn-success btn-primary btn-xs" th:onclick="'javascript:huifu(\''+${role.id}+'\');'">恢复</a>
            </td>
        </tr>

    </table>



</div>

</body>
</html>